<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <body>

        <ui:composition template="./TemplatePrincipal.xhtml">

            <ui:define name="top">
            </ui:define>

            <ui:define name="left">
                <h:form>
                    <p:commandButton action="PrincipalMenu" value="Menu Principal"/>
                </h:form>
            </ui:define>

            <ui:define name="content">
                <f:view>

                    <h:form> 
                        <p:panel header="Autor C/E" footer="Fin c/e" toggleable="true" collapsed="true">
                            <p:growl/>
                            <h1><h:outputText value="Create/Edit"/></h1>
                            <h:panelGrid columns="2">

                                <h:outputLabel value="Clave:" for="clave" />
                                <p:inputMask mask="99-999-999" value="#{authorBean.author.clave}" required="true" requiredMessage="The field clave is required."/>
                                
                                <h:outputLabel value="Nombre:" for="nombre" />
                                <p:inputText id="nombre" value="#{authorBean.author.nombre}" title="Nombre" required="true" requiredMessage="The Nombre field is required." validatorMessage="Nombre no valido">
                                    <f:validateRegex pattern="^[A-Za-z\s]+$"/>
                                </p:inputText>
                                <h:outputLabel value="ApellidoPaterno:" for="apellidoPaterno" />
                                <p:inputText id="apellidoPaterno" value="#{authorBean.author.apellidoPaterno}" title="ApellidoPaterno" required="true" requiredMessage="The ApellidoPaterno field is required." validatorMessage="Apellido Paterno no valido">
                                    <f:validateRegex pattern="^[A-Za-z\s]+$"/>
                                </p:inputText>
                                <h:outputLabel value="ApellidoMaterno:" for="apellidoMaterno" />
                                <p:inputText id="apellidoMaterno" value="#{authorBean.author.apellidoMaterno}" title="ApellidoMaterno" validatorMessage="Apellido Materno no valido">
                                    <f:validateRegex pattern="(^[A-Za-z\s]+$)?"/>
                                </p:inputText>

                                <p:commandButton action="AuthorConfirm" value="Aceptar" ajax="false"/>
                                <p:commandButton action="AuthorList" value ="Cancelar" immediate="true" ajax="false"/>
                            </h:panelGrid>
                        </p:panel>
                    </h:form>
                </f:view>

            </ui:define>

        </ui:composition>

    </body>
</html>
